package com.perfma.xtest.tool;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: junhui.si
 * @date: 2020-11-30 16:36
 **/
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel("agent监控信息列表")
public class AgentMonitor {
    @ApiModelProperty("主键id")
    private Long id;
    @ApiModelProperty("企业id")
    private Long merchantId;
    @ApiModelProperty("agent唯一健")
    private String agentId;
    @ApiModelProperty("集群ip")
    private Long clusterId;
    @ApiModelProperty("机器ip")
    private Long machineId;
    @ApiModelProperty("机器ip")
    private String ip;
    @ApiModelProperty("已加载静态规则版本")
    private Long loadedStaticVersion;
    @ApiModelProperty("已加载动态规则版本")
    private Long loadedDynamicVersion;
    @ApiModelProperty("agent状态。READY-未就绪，NOT_READY-已就绪")
    private AgentState state;
    @ApiModelProperty("失败信息")
    private String failMsg;

    /**
     * agent状态
     */
    public enum AgentState implements BaseCodeEnum {
        /**
         * 就绪
         */
        READY(1, "就绪"),
        /**
         * 未就绪
         */
        NOT_READY(0, "未就绪"),
        ;

        private Integer code;
        private String name;

        AgentState(int code, String name) {
            this.code = code;
            this.name = name;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
}
